import 'package:flutter/material.dart';
import 'package:shopping_group/base/base_constant.dart';
import 'package:shopping_group/res/colors.dart';
import 'package:shopping_group/res/dimens.dart';
import 'package:shopping_group/utils/widget_utils.dart';

class AboutDialogPage extends StatefulWidget {
  AboutDialogPage({
    Key key,
  }) : super(key: key);

  @override
  _AboutDialogPageState createState() => _AboutDialogPageState();
}

class _AboutDialogPageState extends State<AboutDialogPage> {
  // String _version = '1.0.40';
  String _content = '  利正生活，严格挑选品牌、品质、品位三位一体的大众消费品，通过社群共建和产品体验分享，把源头厂家的品牌文化传递给消费者。\n' +
      '  利正生活定位品牌分享平台，致力于打具有造品效合一、长期主义特性的产销共建体系。\n' +
      '  利正生活，构建独特的F2F（即工厂到家庭，农场到家庭）线上社群和线下社区品牌体验式分享模式，形成品牌，消费者，平台以及社会公益紧密互动、共生进化的新商业生态发展范式。\n' +
      '  加入利正生活，人人都是品牌推广员，可以参与品牌分享工作，通过市场的不断历练可以成长为品牌推广师。';
  @override
  void initState() {
    super.initState();
    //获取当前版本
    // PackageInfo.fromPlatform().then((value) {
    //   setState(() {
    //     _version = value.version;
    //   });
    // });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: WidgetUtils.showAppar(context, '关于利正生活'),
      body: GestureDetector(
        behavior: HitTestBehavior.translucent,
        onTap: () {
          // 触摸收起键盘
          FocusScope.of(context).requestFocus(FocusNode());
        },
        child: Container(
          alignment: Alignment.center,
          margin: EdgeInsets.symmetric(horizontal: Dimens.FONT_SIZE_8),
          padding: EdgeInsets.symmetric(vertical: Dimens.FONT_SIZE_12, horizontal: Dimens.FONT_SIZE_16),
          decoration: BoxDecoration(
              border: Border.all(color: Colours.title_white, width: 0.0),
              borderRadius: BorderRadius.circular(10.0),
              color: Colours.title_white),
          child: Column(
            children: <Widget>[
              SizedBox(
                height: 8,
              ),
              GestureDetector(
                onTap: () {
                  Navigator.of(context).pop();
                },
                child: Container(
                  alignment: Alignment.center,
                  decoration: new BoxDecoration(
                    color: Colours.transparent,
                  ),
                  height: 64,
                  width: 64,
                  child: FadeInImage.assetNetwork(
                    image: 'https://lizhengyouxuan.oss-cn-shanghai.aliyuncs.com/lizhengyouxuan/other/app_icon.png',
                    placeholder: 'images/picture_loading.png' /* 指定gif */,
                    fit: BoxFit.fill,
                  ),
                ),
              ),
              SizedBox(
                height: 8,
              ),
              WidgetUtils.getTextColorView(
                'V${BaseConstant.VERSION}',
                Colours.text_2222,
                Dimens.FONT_SIZE_14,
              ),
              SizedBox(
                height: 8,
              ),
              Expanded(
                child: _contentView(),
              ),
            ],
          ),
        ),
      ),
    );
  }

  Widget _contentView() {
    return SingleChildScrollView(
      scrollDirection: Axis.vertical,
      reverse: false,
      padding: EdgeInsets.all(0.0),
      physics: BouncingScrollPhysics(),
      child: WidgetUtils.getTextColorView(
        _content,
        Colours.text_2222,
        Dimens.FONT_SIZE_16,
        // textAlign: TextAlign.center,
      ),
    );
  }

  @override
  void dispose() {
    super.dispose();
  }
}
